#include "NeoPushButton.h"
#include "private/NeoPushButtonPrivate.h"

NEO_PUBLIC_PROPERTY_CREATE_CPP(NeoPushButton, int, BorderRadius)
NEO_PUBLIC_PROPERTY_CREATE_CPP(NeoPushButton, QColor, NormalBackgroundColor)
NEO_PUBLIC_PROPERTY_CREATE_CPP(NeoPushButton, QColor, HoverBackgroundColor)
NEO_PUBLIC_PROPERTY_CREATE_CPP(NeoPushButton, QColor, PressedBackgroundColor)
NEO_PUBLIC_PROPERTY_CREATE_CPP(NeoPushButton, NeoPushButtonType::PushButtonStyle, ButtonStyle)

NeoPushButton::NeoPushButton(QWidget *parent)
    : QPushButton(parent), d_ptr(new NeoPushButtonPrivate())
{
    NEO_PUBLIC_POINT(NeoPushButton)
    d->q_ptr = this;
}

NeoPushButton::NeoPushButton(const QString &text, QWidget *parent)
    : QPushButton(text, parent), d_ptr(new NeoPushButtonPrivate())
{
    NEO_PUBLIC_POINT(NeoPushButton)
    d->q_ptr = this;
}

NeoPushButton::NeoPushButton(const QIcon &icon, const QString &text, QWidget *parent)
    : QPushButton(icon, text, parent), d_ptr(new NeoPushButtonPrivate())
{
    NEO_PUBLIC_POINT(NeoPushButton)
    d->q_ptr = this;
}

NeoPushButton::~NeoPushButton() = default;

void NeoPushButton::paintEvent(QPaintEvent *event)
{
    NEO_PUBLIC_POINT(NeoPushButton)
    NEO_PAINTER_RESET
    d->drawBackground(&painter);
    d->drawIcon(&painter);
    d->drawText(&painter);
}